package com.jinzhi.jzweb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.common.utils.StringUtil;
import org.springframework.stereotype.Service;

import com.jinzhi.jzweb.dao.ProductTypeDao;
import com.jinzhi.jzweb.domain.ProductTypeDO;
import com.jinzhi.jzweb.service.ProductTypeService;
import com.jinzhi.common.base.CoreServiceImpl;

/**
 * 
 * <pre>
 * 商品类型表
 * </pre>
 * <small> 2024-09-18 16:03:15 | lance</small>
 */
@Service
public class ProductTypeServiceImpl extends CoreServiceImpl<ProductTypeDao, ProductTypeDO> implements ProductTypeService {


    /**
     * 商品类型分页列表
     * @param productTypeDO
     * @return
     */
    @Override
    public Page<ProductTypeDO> productList(ProductTypeDO productTypeDO) {
        return this.selectPage(
                new Page<ProductTypeDO>(productTypeDO.getCurrent(), productTypeDO.getSize()),
                new EntityWrapper<ProductTypeDO>()
                        .eq(null != productTypeDO.getCategory(), "category", productTypeDO.getCategory())
                        .eq(null != productTypeDO.getState(), "state", productTypeDO.getState())
                        .like(StringUtil.notEmpty(productTypeDO.getTypeName()), "type_name", productTypeDO.getTypeName())
                        .orderBy("id", false)
        );
    }


}
